#include <SFML/Audio.hpp>
#include <iostream>

int main(int argc, char** argv)
{
	if (!sf::SoundBufferRecorder::CanCapture())
	{
		std::cout << "cant capture audio" << std::endl;
		return(0);
	}
	std::cout << "recorder is ready : ";
	system("pause");
	sf::SoundBufferRecorder recorder;
	recorder.Start();
	std::cout << "recording : ";
	system("pause");
	recorder.Stop();
	sf::SoundBuffer buffer = recorder.GetBuffer();
	std::cout << "file format : ";
	std::string format;
	std::cin >> format;
	buffer.SaveToFile("recorded." + format);
	
	std::cout << "finished : ";
	system("pause");
	sf::Sound sound(buffer);
	sound.SetLoop(true);
	sound.Play();
	std::cout << "playing : ";
	system("pause");
	sound.Stop();
}